/*******************************************
  Jose Andres Lara Vecino

  Author       : $Author: cainlara@gmail.com $
  Last CheckIn : $Date: 2012-10-29 19:04:52 +0000 (Mon, 29 Oct 2012) $
  Revision     : $Revision: 108 $
*******************************************/

package generico;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import javax.swing.DefaultComboBoxModel;
import javax.swing.event.ListDataListener;


/**
 * Super clase para el modelo de un combobox.
 * 
 * @author jose.lara 27.07.2012
 */
public class GenericoComboBoxModel<T> extends DefaultComboBoxModel<T> {
    private static final long serialVersionUID = 4613881743209285234L;
    
    private List<T> datos = null;
    
    public GenericoComboBoxModel(Vector<T> datos) {
        super(datos);
        
        if (datos != null) {
            this.datos = new ArrayList<T>();
            this.datos.addAll(datos);
        }
    }
    
    @Override
    public int getSize() {
        return super.getSize();
    }

    @Override
    public T getElementAt(int index) {
        return super.getElementAt(index);
    }

    @Override
    public void addListDataListener(ListDataListener l) {
        super.addListDataListener(l);
    }

    @Override
    public void removeListDataListener(ListDataListener l) {
        super.removeListDataListener(l);
    }

    @Override
    public void setSelectedItem(Object anItem) {
        super.setSelectedItem(anItem);
    }
    
    @Override
    public Object getSelectedItem() {
        return super.getSelectedItem();
    }

    public List<T> getDatos() {
        return datos;
    }

    public void setDatos(List<T> datos) {
        this.datos = datos;
    }
}